package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.BookDailyAnalysis;
import com.pgybook.db.entity.domain.BookDailyAnalysisEx;
import com.pgybook.db.entity.domain.BookDailyAnalysisKey;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Repository
public interface BookDailyAnalysisMapper {
    int countByExample(BookDailyAnalysisEx example);

    int deleteByExample(BookDailyAnalysisEx example);

    @Delete({
            "delete from bookdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    int deleteByPrimaryKey(BookDailyAnalysisKey key);

    @Insert({
            "insert into bookdailyanalysis (LIBID, BZDAY, ",
            "NEWBOOKNUM, NEWBOOKTOTAL, ",
            "LOSTBOOKNUM, LOSTBOOKTOTAL)",
            "values (#{libid,jdbcType=INTEGER}, #{bzday,jdbcType=DATE}, ",
            "#{newbooknum,jdbcType=INTEGER}, #{newbooktotal,jdbcType=DECIMAL}, ",
            "#{lostbooknum,jdbcType=INTEGER}, #{lostbooktotal,jdbcType=DECIMAL})"
    })
    int insert(BookDailyAnalysis record);

    int insertSelective(BookDailyAnalysis record);

    List<BookDailyAnalysis> selectByExample(BookDailyAnalysisEx example);

    @Select({
            "select",
            "LIBID, BZDAY, NEWBOOKNUM, NEWBOOKTOTAL, LOSTBOOKNUM, LOSTBOOKTOTAL",
            "from bookdailyanalysis",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    @ResultMap("BaseResultMap")
    BookDailyAnalysis selectByPrimaryKey(BookDailyAnalysisKey key);

    int updateByExampleSelective(@Param("record") BookDailyAnalysis record, @Param("example") BookDailyAnalysisEx example);

    int updateByExample(@Param("record") BookDailyAnalysis record, @Param("example") BookDailyAnalysisEx example);

    int updateByPrimaryKeySelective(BookDailyAnalysis record);

    @Update({
            "update bookdailyanalysis",
            "set NEWBOOKNUM = #{newbooknum,jdbcType=INTEGER},",
            "NEWBOOKTOTAL = #{newbooktotal,jdbcType=DECIMAL},",
            "LOSTBOOKNUM = #{lostbooknum,jdbcType=INTEGER},",
            "LOSTBOOKTOTAL = #{lostbooktotal,jdbcType=DECIMAL}",
            "where LIBID = #{libid,jdbcType=INTEGER}",
            "and BZDAY = #{bzday,jdbcType=DATE}"
    })
    int updateByPrimaryKey(BookDailyAnalysis record);
}
